package com.TEAM6.controller;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.TEAM6.beans.BookInfo;
import com.TEAM6.beans.NoticeInfo;
import com.TEAM6.dao.MemberDAO;

public class MainAction implements Action{
	public Forward execute(HttpServletRequest request, HttpServletResponse response) {
		Forward forward = new Forward();
		
		HttpSession session= request.getSession();
		ArrayList<BookInfo> list= new ArrayList<BookInfo>();
		ArrayList<NoticeInfo> list1= new ArrayList<NoticeInfo>();
		MemberDAO dao = new MemberDAO();
		
		list = dao.rentalInfo(session.getAttribute("id").toString());
		request.setAttribute("rentallist",list);
		
		list = dao.delayInfo(session.getAttribute("id").toString());
		request.setAttribute("delaylist", list);
		
		list = dao.bookingInfo(session.getAttribute("id").toString());
		request.setAttribute("bookinglist", list);
		
		list1 = dao.NoticeInfo();
		request.setAttribute("noticelist", list1);
		
		list1 = dao.FreeBoardInfo();
		request.setAttribute("freeboardlist", list1);
		
		
		forward.setRedirect(false);
		forward.setPagePath("./main.jsp");
		
		return forward;
	}
}
